package com.netease.nimlib.ipc.cp.data;

import android.content.Context;

/**
 * URI数据处理器接口
 * <p>
 * Created by huangjun on 2017/10/31.
 */
public abstract class IDataHandler {

    protected final Context context;

    protected final String name;

    protected IDataHandler(Context context, String name) {
        this.context = context;
        this.name = name;
    }

    public abstract boolean hasKey(final String key);

    /// uri query 业务

    public abstract String onQueryString(final String key, final String defaultValue);

    public abstract boolean onQueryBoolean(String key, boolean defaultValue);

    public abstract int onQueryInt(final String key, final int defaultValue);

    public abstract float onQueryFloat(final String key, final float defaultValue);

    public abstract long onQueryLong(final String key, final long defaultValue);

    /// uri update 业务

    public abstract void onHandleString(final String key, final String value);

    public abstract void onHandleBoolean(final String key, final boolean value);

    public abstract void onHandleInt(final String key, final int value);

    public abstract void onHandleFloat(final String key, final float value);

    public abstract void onHandleLong(final String key, final long value);

    /// uri update 业务（用于非持久化业务、定制化事件处理）

    public abstract void onHandleVoid(final String key, final String value);

    /// uri delete 业务

    public abstract void onRemoveKey(final String key);
}
